Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix non-root hosts failing on resolving DNS #2269

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

same-id
Copy link

@same-id same-id commented Oct 27, 2024

A fix for a bug introduced by #2168

Previously, config.Host worked in the following way:

  1. Documented as supporting ip addresses only
  2. In fact supported "host/path" syntax
  3. Did not support "scheme" prefixes, i.e. https://

Not sure this is the desired approach, probably the best thing would have been to extend config to contain "Scheme" and "Path" fields as well.

However, this was the way it worked.

  1. Now Host can contain scheme prefixes "unix://..."
  2. Host can no longer contain ".../path"

This PR solves this behavior while maintaining support of the "unix://" flow as well.

For some reason, "scheme" is named "network" in #2168 - I did not change that.

Also, remove disambiguation in "network:address:port", where it parsed "myhost:8888" as network:address instead address:port.

Also see: #2253

@same-id same-id force-pushed the fix-non-root-hosts branch 3 times, most recently from 0b754dc to 6cca6f1 Compare October 28, 2024 10:47
@guggero
Copy link
Collaborator

guggero commented Oct 28, 2024

Thanks for looking into this.
Though this project uses an older Golang version that doesn't support the strings.CutPrefix function yet.

 rpcclient/infrastructure.go:1743: undefined: strings.CutPrefix
rpcclient/infrastructure.go:1746: undefined: strings.CutPrefix

@same-id
Copy link
Author

same-id commented Oct 28, 2024

Fixed

Copy link
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See inline comments, I'm not sure this actually fixes your issue?

rpcclient/infrastructure.go Outdated Show resolved Hide resolved
rpcclient/infrastructure.go Outdated Show resolved Hide resolved
rpcclient/infrastructure.go Outdated Show resolved Hide resolved
rpcclient/infrastructure.go Show resolved Hide resolved
@same-id
Copy link
Author

same-id commented Nov 6, 2024

gentle bump - reminding that ATM btcd@master is broken with providers like quicknode

@coveralls
Copy link

coveralls commented Nov 6, 2024

Pull Request Test Coverage Report for Build 11741038287

Details

  • 22 of 50 (44.0%) changed or added relevant lines in 1 file are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.02%) to 57.254%

Changes Missing Coverage Covered Lines Changed/Added Lines %
rpcclient/infrastructure.go 22 50 44.0%
Files with Coverage Reduction New Missed Lines %
rpcclient/infrastructure.go 2 39.96%
Totals Coverage Status
Change from base Build 11704113837: 0.02%
Covered Lines: 29890
Relevant Lines: 52206

💛 - Coveralls

Copy link
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should clean this up a bit more and add some basic tests.

Here's my proposal as a diff (feel free to just use in your commit, no attribution required):
proposal.diff.txt

rpcclient/infrastructure.go Show resolved Hide resolved
A fix for a bug introduced by btcsuite#2168

Previously, config.Host worked in the following way:
1. Documented as supporting ip addresses only
2. In fact supported "host/path" syntax
3. Did not support "scheme" prefixes, i.e. https://

Not sure this is the desired approach, probably the best thing would
have been to extend config to contain "Scheme" and "Path" fields as well.

However, this was the way it worked.

1. Now Host can contain scheme prefixes "unix://..."
2. Host can no longer contain ".../path"

This PR solves this behavior while maintaining support of the "unix://" flow
as well.

For some reason, "scheme" is named "network" in btcsuite#2168 - I did not change that.

Also remove disambiguation in "network:address:port", where it parsed
"myhost:8888" as network:address instead address:port.
Copy link
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM 🎉

@same-id
Copy link
Author

same-id commented Nov 9, 2024

Thanks, LGTM 🎉

Thanks for the review, still pending approval from another reviewer: @Crypt-iQ

@same-id
Copy link
Author

same-id commented Nov 11, 2024

@guggero - just making sure we are really waiting for an additional reviewer here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants